package dao.entity;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import model.Sach;
import dao.AbstractDAO;
import dao.DatabaseConnector;

public class SachDAO extends AbstractDAO<Sach, Integer> {
	public SachDAO() {
		super(Sach.class);
	}

	public static Sach getByID(int id) {
		SachDAO sachDAO = new SachDAO();
		Sach sach = sachDAO.findByID(id);
		return sach;
	}

//	@SuppressWarnings("unchecked")
//	public static List<Sach> getTheLoai(int id) {
//		EntityManager entityManager = DatabaseConnector.getEntityManager();
//		Query q = entityManager
//				.createQuery("select o from Sach o where o.ID_Theloai= :ID_Theloai");
//		q.setParameter(id, "ID_Theloai");
//		return q.getResultList();
//
//	}

}
